#include<cstdio>
int main(){
	int n;
	int m;
	scanf("%d %d",&m,&n);
	int x[m];
	for(int y=0;y<m;y++){
		x[y]=1;
	}
	int count=0;
	int count2=0;
	int g=0;
	while(count2!=m){
		if(x[g]==1){
			count++;
			if(count%n==0){
				x[g]=0;
				printf("%4d",g+1);
				count2++;
			}
		}
		g++;
		if(g==m){
			g=0;
		}
	}
}
